M291 S4 K{"OK, Ethernet is connected","Cancel"} R"Connect via Ethernet" P"Please connect the Ethernet cable to the device. Once connected, press ""OK"" to continue."

if input = 0
	M292 ;Continue
else
	M99


M291 S4 K{"Test Connection","Skip Test and Change Mode"} R"Test Network Connection" P"Machine will test the connection and restart into AP WiFi mode.<br>Skipped and connect by using ""22.local"" address in your browser for ITAR"
if input = 0
	M292 ;Continue
else
	echo >"0:/user/networkmode.g" "M552 I0 S1 ; Enable Ethernet mode"

	M552 I1 S-1
	G4 S1
	M552 I0 S0
	G4 S1
	M552 I0 S1

	echo "Ethernet mode Enabled"
	M99


M291 S2 R"Restart Notification" P"Machine will restart now.<br>If LEDs are GREEN, the connection was established. If RED, it failed.<br>Machine will restart into AP Mode.<br>Reconnect to the ""22 IDEX"" WiFi network after you see the green or red LED."


M98 P"0:/sys/led/resetstatus.g"

M552 I1 S-1
G4 S1
M552 I0 S1
G1 S1

while network.interfaces[0].actualIP = "0.0.0.0" || network.interfaces[0].actualIP = "192.168.0.1" && iterations < 30
  G4 S1


if network.interfaces[0].actualIP = "0.0.0.0" || network.interfaces[0].actualIP = "192.168.0.1"
	M98 P"0:/sys/led/dimmwhite.g"
	M98 P"0:/sys/led/red.g"
	M98 P"0:/macros/System/Settings/Network/Enable WiFi - Access Point Mode" R1
	
	M552 I1 S-1
	G4 S1
	M552 I1 S2
	
	M291 S2 R"Connection was not established" P"Please try again"

else
	M98 P"0:/sys/led/end.g"
	echo >"0:/user/networkmode.g" "M552 I0 S1 ; Enable Ethernet mode"

	var ip = network.interfaces[0].actualIP

	M552 I0 S0
	G4 S1
	M552 I1 S2	
			
	
	M291 S4 K{"Cancel","OK"} R{"The IP address is: """^var.ip^""""} P{"To access DWC, in your browser enter """^var.ip^""" Press ""OK"" to switch Network mode now or restart the machine"}
	
	if input = 1
		M552 I1 S-1
		G4 S1
		M552 I0 S1


M98 P"0:/sys/led/resetstatus.g"